/*
package com.hzmg.route;

import reactor.core.publisher.Flux;

import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;

public class Routes {

    public static LocatorBuilder locator() {
        return new LocatorBuilder();
    }

    public static class LocatorBuilder {
        private List<Route> routes = new ArrayList<>();

        public PredicateSpec route(String id) {
            return new RouteSpec(this).id(id);
        }

        LocatorBuilder uri(Route.Builder builder, String uri) {
            Route route = builder.uri(uri).build();
            return this;
        }

        LocatorBuilder uri(Route.Builder builder, URI uri) {
            Route route = builder.uri(uri).build();
            return this;
        }

        public RouteLocator build() {
            return () -> Flux.fromIterable(this.routes);
        }
    }

    public static class RouteSpec {
        private final Route.Builder builder = Route.builder();

        private final LocatorBuilder locatorBuilder;

        private RouteSpec(LocatorBuilder locatorBuilder) {
            this.locatorBuilder = locatorBuilder;
        }

        public PredicateSpec id(String id) {
            this.builder.id(id);
            return predicateBuilder();
        }

        private PredicateSpec predicateBuilder() {
            return new PredicateSpec(this.builder, this.locatorBuilder);
        }
    }

    public static class PredicateSpec {

        private final Route.Builder builder;

        private LocatorBuilder locatorBuilder;

        public PredicateSpec(Route.Builder builder, LocatorBuilder locatorBuilder) {
            this.builder = builder;
            this.locatorBuilder = locatorBuilder;
        }

        public PredicateSpec order(int order) {
            this.builder.order(order);
            return this;
        }

        public GatewayFilterSpec predicate(Predicate<String> predicate) {
            this.builder.predicate(predicate);
            return gatewayFilterBuilder();
        }

        private GatewayFilterSpec gatewayFilterBuilder() {
            return new GatewayFilterSpec(this.builder, this.locatorBuilder);
        }

        public LocatorBuilder uri(String uri) {
            return this.locatorBuilder.uri(this.builder, uri);
        }

        public LocatorBuilder uri(URI uri) {
            return this.locatorBuilder.uri(this.builder, uri);
        }
    }

    public static class GatewayFilterSpec {

        private Route.Builder builder;

        private LocatorBuilder locatorBuilder;

        public GatewayFilterSpec(Route.Builder routeBuilder, LocatorBuilder locatorBuilder) {
            this.builder = routeBuilder;
            this.locatorBuilder = locatorBuilder;
        }

        */
/**
         * TODO: filter logic
         *
         *//*


        public LocatorBuilder uri(String uri) {
            return this.locatorBuilder.uri(this.builder, uri);
        }

        public LocatorBuilder uri(URI uri) {
            return this.locatorBuilder.uri(this.builder, uri);
        }

    }
}
*/
